////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :
// AUTHOR           :
// DATE CREATE      :
// DESCRIPTION      :
//                  :
//                  :
//                  :
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  ----------------------------
// 2006/04/26   Ric Yik         1.0                 BugZilla #5535
//
//
////////////////////////////////////////////////////////////////////////////////
package com.erp.framework.model.schema;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import com.erp.framework.SimpleConstants;
import com.erp.framework.util.CommonUtil;

public class MetaData implements Serializable, SimpleConstants {

    private Map stereoTypes = new HashMap();

    private String tableName = "";
    private String columnName = "";
    private String voPropertyName = "";
    private String columnTitle = "";
    private String columnTypeName = "";
    private int columnType = 0;
    private int columnSize = 0;
    private String columnCatalogName = "";
    private String columnClassName = "";
    private int columnPrecision = 0;
    private int columnScale = 0;
    private int displaySize = 0;
    private int textAreaColSize = 0;
    private int textAreaRowSize = 0;
    private int isNullable = -1; // accept value
    private String webObjectId;
    private String webLabelName;
    private String contentTypeProperty;
    private String imageWidthProperty;
    private String imageHeightProperty;
    private String imageThumbnailProperty;
    private String descriptionProperty;
    private String fileNameProperty;
    private String Identifier;
    private String toRangePropertyName;
    private boolean toRangeInclusive;

    private boolean includePositive = true;
    private boolean includeZero = true;
    private boolean includeNegative = true;

    private boolean code = false; // Code or Document Number

    private String uiType = UI_TYPE_TEXT;
    private boolean autoGenerated = false;
    private boolean spaceAllowed;

    public String getColumnCatalogName() {
        return columnCatalogName;
    }

    public void setColumnCatalogName(String columnCatalogName) {
        this.columnCatalogName = columnCatalogName;
    }

    public String getColumnClassName() {
        return columnClassName;
    }

    public void setColumnClassName(String columnClassName) {
        this.columnClassName = columnClassName;
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public int getColumnPrecision() {
        return columnPrecision;
    }

    public void setColumnPrecision(int columnPrecision) {
        this.columnPrecision = columnPrecision;
    }

    public int getColumnScale() {
        return columnScale;
    }

    public void setColumnScale(int columnScale) {
        this.columnScale = columnScale;
    }

    public int getColumnSize() {
        return columnSize;
    }

    public void setColumnSize(int columnSize) {
        this.columnSize = columnSize;
    }

    public String getColumnTitle() {
        return columnTitle;
    }

    public void setColumnTitle(String columnTitle) {
        this.columnTitle = columnTitle;
    }

    public int getColumnType() {
        return columnType;
    }

    public void setColumnType(int columnType) {
        this.columnType = columnType;
    }

    public String getColumnTypeName() {
        return columnTypeName;
    }

    public void setColumnTypeName(String columnTypeName) {
        this.columnTypeName = columnTypeName;
    }

    public int getIsNullable() {
        return isNullable;
    }

    public void setIsNullable(int isNullable) {
        this.isNullable = isNullable;
    }

    public String getVoPropertyName() {
        return voPropertyName;
    }

    public void setVoPropertyName(String voPropertyName) {
        this.voPropertyName = voPropertyName;
    }

    public int getDisplaySize() {
        return displaySize;
    }

    public void setDisplaySize(int displaySize) {
        this.displaySize = displaySize;
    }

    public String getWebLabelName() {
        return webLabelName;
    }

    public void setWebLabelName(String webLabelName) {
        this.webLabelName = webLabelName;
    }

    public String getWebObjectId() {
        return webObjectId;
    }

    public void setWebObjectId(String webObjectId) {
        this.webObjectId = webObjectId;
    }

	public int getTextAreaColSize() {
		return textAreaColSize;
	}

	public void setTextAreaColSize(int textAreaColSize) {
		this.textAreaColSize = textAreaColSize;
	}

	public int getTextAreaRowSize() {
		return textAreaRowSize;
	}

	public void setTextAreaRowSize(int textAreaRowSize) {
		this.textAreaRowSize = textAreaRowSize;
	}

    public String getUiType() {
        return uiType;
    }

    public void setUiType(String uiType) {
        this.uiType = uiType;
    }

    public boolean isAutoGenerated() {
        return autoGenerated;
    }

    public void setAutoGenerated(boolean autoGenerated) {
        this.autoGenerated = autoGenerated;
    }

    public boolean isNullable() {
        return this.getIsNullable() == 1;
    }

    public void setNullable(boolean nullable) {
        this.setIsNullable((nullable) ? 1 : 0);
    }

    public boolean isIncludeNegative() {
        return includeNegative;
    }

    public void setIncludeNegative(boolean includeNegative) {
        this.includeNegative = includeNegative;
    }

    public boolean isIncludePositive() {
        return includePositive;
    }

    public void setIncludePositive(boolean includePositive) {
        this.includePositive = includePositive;
    }

    public boolean isIncludeZero() {
        return includeZero;
    }

    public void setIncludeZero(boolean includeZero) {
        this.includeZero = includeZero;
    }

    public boolean isPositiveNumeric() {
        return !this.isIncludeNegative() && !this.isIncludeZero();
    }

    public boolean isNegativeNumeric() {
        return !this.isIncludePositive() && !this.isIncludeZero();
    }

    public boolean isNonnegativeNumeric() {
        return !this.isIncludeNegative() && this.isIncludeZero();
    }

    public boolean isNumeric() {
        return this.isIncludeNegative() && this.isIncludeZero() && this.isIncludePositive();
    }

    public boolean isCode() {
        return this.code;
    }

    public void setCode(boolean code) {
        this.code = code;
    }

    public void setSpaceAllowed(boolean b) {
        this.spaceAllowed = b;
    }

    public boolean isSpaceAllowed() {
        return spaceAllowed;
    }

    public String getContentTypeProperty() {
        return contentTypeProperty;
    }

    public void setContentTypeProperty(String contentTypeProperty) {
        this.contentTypeProperty = contentTypeProperty;
    }

    public String getImageHeightProperty() {
        return imageHeightProperty;
    }

    public void setImageHeightProperty(String imageHeightProperty) {
        this.imageHeightProperty = imageHeightProperty;
    }

    public String getImageWidthProperty() {
        return imageWidthProperty;
    }

    public void setImageWidthProperty(String imageWidthProperty) {
        this.imageWidthProperty = imageWidthProperty;
    }

    public String getDescriptionProperty() {
        return descriptionProperty;
    }

    public void setDescriptionProperty(String descriptionProperty) {
        this.descriptionProperty = descriptionProperty;
    }

    public String getFileNameProperty() {
        return fileNameProperty;
    }

    public void setFileNameProperty(String fileNameProperty) {
        this.fileNameProperty = fileNameProperty;
    }

    public String getImageThumbnailProperty() {
        return imageThumbnailProperty;
    }

    public void setImageThumbnailProperty(String imageThumbnailProperty) {
        this.imageThumbnailProperty = imageThumbnailProperty;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getRangeToPropertyName() {
        return toRangePropertyName;
    }

    public void setToRangePropertyName(String toRangePropertyName) {
        this.toRangePropertyName = toRangePropertyName;
    }

    public boolean isToRangeInclusive() {
        return toRangeInclusive;
    }

    public void setToRangeInclusive(boolean toRangeInclusive) {
        this.toRangeInclusive = toRangeInclusive;
    }

    public Map getStereoTypes() {
        return stereoTypes;
    }

    public void setStereoTypes(Map stereoTypes) {
        this.stereoTypes = stereoTypes;
    }

    public void setStereoType(String stereoType) {
        this.getStereoTypes().put(stereoType, new HashMap());
    }

    public void removeStereoType(String stereoType) {
        this.getStereoTypes().remove(stereoType);
    }

    public boolean containsStereoType(String stereoType) {
        return this.getStereoTypes().containsKey(stereoType);
    }

    public Map getStereoType(String stereoType) {
        return (Map) this.getStereoTypes().get(stereoType);
    }

    public boolean isAmount() {
        return this.containsStereoType(StereoType.AMOUNT);
    }

    public void setAmount(boolean amount) {
        if (amount) {
            this.setStereoType(StereoType.AMOUNT);
        } else {
            this.removeStereoType(StereoType.AMOUNT);
        }
    }

    public boolean isNdcDate() {
        return this.containsStereoType(StereoType.NDC_DATE);
    }

    public void setNdcDate(boolean ndcDate) {
        if (ndcDate) {
            this.setStereoType(StereoType.NDC_DATE);
        } else {
            this.removeStereoType(StereoType.NDC_DATE);
        }
    }

    public boolean isRangeFrom() {
        return !CommonUtil.isEmpty(this.getRangeToPropertyName());
    }

	public String getIdentifier() {
		return Identifier;
	}

	public void setIdentifier(String identifier) {
		Identifier = identifier;
	}

}
